package xyz.qduwo.entity;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "Room_Userlist", schema = "dbo", catalog = "streamboard")
public class RoomUserlistEntity {
    private int id;
    private int room;
    private int user;
    private Date joinedTime;
    private Date exitTime;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "room")
    public int getRoom() {
        return room;
    }

    public void setRoom(int room) {
        this.room = room;
    }

    @Basic
    @Column(name = "user")
    public int getUser() {
        return user;
    }

    public void setUser(int user) {
        this.user = user;
    }

    @Basic
    @Column(name = "joined_time")
    public Date getJoinedTime() {
        return joinedTime;
    }

    public void setJoinedTime(Date joinedTime) {
        this.joinedTime = joinedTime;
    }

    @Basic
    @Column(name = "exit_time")
    public Date getExitTime() {
        return exitTime;
    }

    public void setExitTime(Date exitTime) {
        this.exitTime = exitTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RoomUserlistEntity that = (RoomUserlistEntity) o;
        return id == that.id &&
                room == that.room &&
                user == that.user &&
                Objects.equals(joinedTime, that.joinedTime) &&
                Objects.equals(exitTime, that.exitTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, room, user, joinedTime, exitTime);
    }
}
